*****************************************
*Replication codes
*****************************************

use main_final.dta, clear 

*****************************************
*Table 1 & Table J1 (Full Results)
***************************************** 
*column (1)
reghdfe competition c.inc_lose if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)   

*column (2)
reghdfe competition c.inc_lose c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 

*column (3)
reghdfe competition c.inc_lose c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==1, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  

*****************************************
*Table 2 & Table J3 (Full Results)
*****************************************
reghdfe competition c.inc_lose##c.ratio##c.gap c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
   
*top left cell
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947        +c.inc_lose#c.ratio#c.gap*  .1578947    *  -.1747589    + c.inc_lose#c.gap*  -.1747589 
*top right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429    +c.inc_lose#c.ratio#c.gap*  .8571429   * -.1747589     + c.inc_lose#c.gap* -.1747589  
*bottom left cell 
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947     +c.inc_lose#c.ratio#c.gap*  .1578947     *   .1997465      + c.inc_lose#c.gap * .1997465   
*bottom right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429   +c.inc_lose#c.ratio#c.gap *  .8571429   *  .1997465     + c.inc_lose#c.gap *  .1997465 

*****************************************
*Appendix
*****************************************
*****************************************
*Table B1 
*****************************************
summarize competition if placebo==0, detail
summarize inc_lose if placebo==0, detail
summarize gap if placebo==0, detail
summarize ratio if placebo==0, detail
summarize ln_oppose_firm if placebo==0, detail
summarize agency_politicized if placebo==0, detail
summarize ln_amount if placebo==0, detail
summarize price if placebo==0, detail
summarize dwnom1 if placebo==0, detail
summarize appr_ways_comm if placebo==0, detail
summarize chair_appro_h if placebo==0&!missing(appr_ways_comm), detail
summarize chair_appro_s if placebo==0&!missing(appr_ways_comm), detail
summarize seniority if placebo==0, detail
summarize majority_memb if placebo==0, detail
summarize female if placebo==0, detail
summarize black if placebo==0, detail
summarize latino if placebo==0, detail
summarize battle_next if placebo==0, detail
summarize battle_prev if placebo==0, detail
summarize veteran_owned if placebo==0, detail
summarize small_owned if placebo==0, detail
summarize minority_owned if placebo==0, detail
summarize c8a if placebo==0, detail
summarize his_underutilized if placebo==0, detail

*****************************************
*Table B2 
*****************************************
gen cong=0
replace cong=109 if year==2005|year==2006
replace cong=111 if year==2009|year==2010
replace cong=115 if year==2017|year==2018
egen id2 = group(product_or_service_code cong)
bysort id2: generate n2 = _n

summarize ratio if placebo==0&n2==1, detail
summarize gap if placebo==0&n2==1, detail

*****************************************
*Table C1
*****************************************
use predictit.dta, clear

*column(1)
reghdfe competition c.inc_lose c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  
*column(2)
reghdfe ln_amount c.inc_lose c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  
*column(3)
reghdfe price c.inc_lose c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  

*****************************************
*Table C2
*****************************************
reghdfe competition c.inc_lose##c.ratio##c.gap c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
   
*top left cell
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947        +c.inc_lose#c.ratio#c.gap*  .1578947    *  -.1747589    + c.inc_lose#c.gap*  -.1747589 
*top right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429    +c.inc_lose#c.ratio#c.gap*  .8571429   * -.1747589     + c.inc_lose#c.gap* -.1747589  
*bottom left cell 
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947     +c.inc_lose#c.ratio#c.gap*  .1578947     *   .1997465      + c.inc_lose#c.gap * .1997465   
*bottom right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429   +c.inc_lose#c.ratio#c.gap *  .8571429   *  .1997465     + c.inc_lose#c.gap *  .1997465 


*****************************************
*Table D1
*****************************************
use main_final.dta, clear
*column(1)
gen inc_lose_a = 0
replace inc_lose_a = inc_lose if delivery==1
replace inc_lose_a = inc_lose_lag40 if delivery==0 
reghdfe competition c.inc_lose_a c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
drop inc_lose_a
*column(2)
gen inc_lose_a = 0
replace inc_lose_a = inc_lose if delivery==1
replace inc_lose_a = inc_lose_lag30 if delivery==0 
reghdfe competition c.inc_lose_a c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
drop inc_lose_a
*column(3)
gen inc_lose_a = 0
replace inc_lose_a = inc_lose if delivery==1
replace inc_lose_a = inc_lose_lag20 if delivery==0 
reghdfe competition c.inc_lose_a c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
drop inc_lose_a
*column(4)
gen inc_lose_a = 0
replace inc_lose_a = inc_lose if delivery==1
replace inc_lose_a = inc_lose_lag10 if delivery==0
reghdfe competition c.inc_lose_a c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
drop inc_lose_a

*****************************************
*Table D2
***************************************** 
*column(1)
reghdfe competition c.inc_lose_lag40 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
*column(2)
reghdfe competition c.inc_lose_lag30 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  
*column(3)
reghdfe competition c.inc_lose_lag20 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
*column(4)
reghdfe competition c.inc_lose_lag10 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  

*****************************************
*Table D3
*****************************************
*column(1)
reghdfe competition c.inc_lose_lead10 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
*column(2)
reghdfe competition c.inc_lose_lead20 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
*column(3)
reghdfe competition c.inc_lose_lead30 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  
*column(4)
reghdfe competition c.inc_lose_lead40 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev  chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  

*****************************************
*Table E1
*****************************************
reghdfe check2 c.inc_lose c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  

*****************************************
*Table E2
*****************************************
reghdfe competition c.inc_lose##c.placebo c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  

*****************************************
*Table E3 & Figure E1
*****************************************
grstyle clear
set scheme s2color
grstyle init
grstyle set plain, box
grstyle color background white
grstyle set color Set1
grstyle yesno draw_major_hgrid yes
grstyle yesno draw_major_ygrid yes
grstyle color major_grid gs8
grstyle linepattern major_grid dot
grstyle set legend 4, box inside
grstyle color ci_area gs12%50

summarize trend_lame
generate days = -trend_lame
replace days=days+ 54 if year==2006
replace days=days+ 59 if year==2010
replace days=days+ 55 if year==2017
replace days=days+ 55 if year==2018
summarize days  
global MyMin = r(min)
global MyMax =r(max)
global Grid = ($MyMax-$MyMin)/30
reghdfe competition c.inc_lose##c.days c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)  
quietly margins, dydx(inc_lose) at(c.days =($MyMin ($Grid) $MyMax))
marginsplot,xlabel(-660(60)0) recast(line) plot1opts(lcolor(gs8)) ciopt(color(black%20)) recastci(rarea) title("") xtitle("Days Until the Election Day") ytitle("The Effect on Pr(Providing Competitive Contracts)") yline(0)


*****************************************
*Table E4
*****************************************
gen inc_firm_50 = 0 
replace inc_firm_50= above50_num if year==2005|year==2006|year==2017|year==2018
replace inc_firm_50= below50_num if year==2009|year==2010

gen ratio_50= inc_firm_50/connected_firm 

reghdfe competition c.inc_lose##c.ratio_50##c.gap_50 c.agency_politicized c.ln_connected c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
   
lincom c.inc_lose+ c.inc_lose#c.ratio*   .5      +c.inc_lose#c.ratio#c.gap*    .5   *    -.0714205    + c.inc_lose#c.gap*    -.0714205  
lincom c.inc_lose+ c.inc_lose#c.ratio*    .9444444     +c.inc_lose#c.ratio#c.gap*    .9444444    *  -.0714205     + c.inc_lose#c.gap*  -.0714205  
lincom c.inc_lose+ c.inc_lose#c.ratio*   .5   +c.inc_lose#c.ratio#c.gap*     .5     *   .2253735     + c.inc_lose#c.gap *   .2253735      
lincom c.inc_lose+ c.inc_lose#c.ratio*    .9444444    +c.inc_lose#c.ratio#c.gap *    .9444444    *    .2253735       + c.inc_lose#c.gap *     .2253735 

*****************************************
*Table E5
*****************************************
gen ratio_70= inc70_num/connected_firm

reghdfe competition c.inc_lose##c.ratio_70##c.gap_70 c.agency_politicized c.ln_connected c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal if ratio_70!=0&placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
   
lincom c.inc_lose+ c.inc_lose#c.ratio*  .0816327      +c.inc_lose#c.ratio#c.gap*   .0816327  *   -.3813514     + c.inc_lose#c.gap*   -.3813514   
lincom c.inc_lose+ c.inc_lose#c.ratio*    .5    +c.inc_lose#c.ratio#c.gap*    .5   *  -.3813514     + c.inc_lose#c.gap*  -.3813514   
lincom c.inc_lose+ c.inc_lose#c.ratio*  .0816327   +c.inc_lose#c.ratio#c.gap*   .0816327 *    .1243221          + c.inc_lose#c.gap *    .1243221       
lincom c.inc_lose+ c.inc_lose#c.ratio*    .5   +c.inc_lose#c.ratio#c.gap *   .5    *    .1243221            + c.inc_lose#c.gap *     .1243221  

*****************************************
*Table E6
*****************************************
gen ratio_80= inc80_num/connected_firm

reghdfe competition c.inc_lose##c.ratio_80##c.gap_80 c.agency_politicized c.ln_connected c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal if ratio_80!=0&placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
   
lincom c.inc_lose+ c.inc_lose#c.ratio*   .0322581      +c.inc_lose#c.ratio#c.gap*   .0322581  *   -.3403152     + c.inc_lose#c.gap*   -.3403152
lincom c.inc_lose+ c.inc_lose#c.ratio*    .2916667     +c.inc_lose#c.ratio#c.gap*    .2916667     *  -.3403152      + c.inc_lose#c.gap*   -.3403152 
lincom c.inc_lose+ c.inc_lose#c.ratio*   .0322581    +c.inc_lose#c.ratio#c.gap*   .0322581  *     .1675078       + c.inc_lose#c.gap *     .1675078     
lincom c.inc_lose+ c.inc_lose#c.ratio*  .2916667    +c.inc_lose#c.ratio#c.gap *   .2916667     *    .1675078           + c.inc_lose#c.gap *    .1675078

*****************************************
*Table E7
*****************************************
gen ratio_90= inc90_num/connected_firm

reghdfe competition c.inc_lose##c.ratio_90##c.gap_90 c.agency_politicized c.ln_connected c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal if ratio_90!=0&placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)
   
lincom c.inc_lose+ c.inc_lose#c.ratio*  .0227273      +c.inc_lose#c.ratio#c.gap*  .0227273     *   -.3974373       + c.inc_lose#c.gap*   -.3974373    
lincom c.inc_lose+ c.inc_lose#c.ratio*  .2222222      +c.inc_lose#c.ratio#c.gap*  .2222222     *   -.3974373       + c.inc_lose#c.gap*    -.3974373    
lincom c.inc_lose+ c.inc_lose#c.ratio*   .0227273     +c.inc_lose#c.ratio#c.gap*   .0227273    *       .084689        + c.inc_lose#c.gap *    .084689     
lincom c.inc_lose+ c.inc_lose#c.ratio* .2222222     +c.inc_lose#c.ratio#c.gap *  .2222222      *     .084689           + c.inc_lose#c.gap *     .084689   

*****************************************
*Table E8
***************************************** 
clear
use main_final.dta
tempfile master
save `master', replace empty
use bunching.dta, clear
append using `master', force

reghdfe competition c.inc_lose c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)


*****************************************
*Table E9
*****************************************
reghdfe competition c.inc_lose##c.ratio##c.gap c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 
   
*top left cell
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947        +c.inc_lose#c.ratio#c.gap*  .1578947    *  -.1747589    + c.inc_lose#c.gap*  -.1747589 
*top right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429    +c.inc_lose#c.ratio#c.gap*  .8571429   * -.1747589     + c.inc_lose#c.gap* -.1747589  
*bottom left cell 
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947     +c.inc_lose#c.ratio#c.gap*  .1578947     *   .1997465      + c.inc_lose#c.gap * .1997465   
*bottom right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429   +c.inc_lose#c.ratio#c.gap *  .8571429   *  .1997465     + c.inc_lose#c.gap *  .1997465 


*****************************************
*Table E10
*****************************************
clear
use contract_sap.dta

*column (1)
reghdfe competition c.inc_lose, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean) 

*column (2)
reghdfe competition c.inc_lose c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)

*****************************************
*Table E11
*****************************************
reghdfe competition c.inc_lose##c.ratio##c.gap c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date)

*top left cell
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947        +c.inc_lose#c.ratio#c.gap*  .1578947    *  -.1747589    + c.inc_lose#c.gap*  -.1747589 
*top right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429    +c.inc_lose#c.ratio#c.gap*  .8571429   * -.1747589     + c.inc_lose#c.gap* -.1747589  
*bottom left cell 
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947     +c.inc_lose#c.ratio#c.gap*  .1578947     *   .1997465      + c.inc_lose#c.gap * .1997465   
*bottom right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429   +c.inc_lose#c.ratio#c.gap *  .8571429   *  .1997465     + c.inc_lose#c.gap *  .1997465 


*****************************************
*Table E12
*****************************************
use main_final.dta, clear

reghdfe ln_amount c.inc_lose##c.ratio##c.gap c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 

*top left cell
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947        +c.inc_lose#c.ratio#c.gap*  .1578947    *  -.1747589    + c.inc_lose#c.gap*  -.1747589 
*top right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429    +c.inc_lose#c.ratio#c.gap*  .8571429   * -.1747589     + c.inc_lose#c.gap* -.1747589  
*bottom left cell 
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947     +c.inc_lose#c.ratio#c.gap*  .1578947     *   .1997465      + c.inc_lose#c.gap * .1997465   
*bottom right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429   +c.inc_lose#c.ratio#c.gap *  .8571429   *  .1997465     + c.inc_lose#c.gap *  .1997465 

*****************************************
*Table E13
*****************************************
reghdfe price c.inc_lose##c.ratio##c.gap c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 

*top left cell
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947        +c.inc_lose#c.ratio#c.gap*  .1578947    *  -.1747589    + c.inc_lose#c.gap*  -.1747589 
*top right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429    +c.inc_lose#c.ratio#c.gap*  .8571429   * -.1747589     + c.inc_lose#c.gap* -.1747589  
*bottom left cell 
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947     +c.inc_lose#c.ratio#c.gap*  .1578947     *   .1997465      + c.inc_lose#c.gap * .1997465   
*bottom right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429   +c.inc_lose#c.ratio#c.gap *  .8571429   *  .1997465     + c.inc_lose#c.gap *  .1997465 

*****************************************
*Table E14
*****************************************
reghdfe competition c.inc_lose##c.ratio##c.gap_median c.agency_politicized c.ln_connected c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_prev battle_next chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) 

lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947        +c.inc_lose#c.ratio#c.gap*  .1578947    *-.1238177    + c.inc_lose#c.gap*  -.1238177 
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429    +c.inc_lose#c.ratio#c.gap*  .8571429   *-.1238177      + c.inc_lose#c.gap* -.1238177   
lincom c.inc_lose+ c.inc_lose#c.ratio* .1578947     +c.inc_lose#c.ratio#c.gap*  .1578947     *   .1347864      + c.inc_lose#c.gap *  .1347864  
lincom c.inc_lose+ c.inc_lose#c.ratio*  .8571429   +c.inc_lose#c.ratio#c.gap *  .8571429   *  .1347864     + c.inc_lose#c.gap *   .1347864 

*****************************************
*Table F1
*****************************************
reghdfe competition c.inc_lose##i.year c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)

*****************************************
*Table F2
*****************************************
*effect in 2006 is baseline coefficient of inc_lose in the previous regression
*effect in 2010
lincom inc_lose + 2010bn.year#c.inc_lose
*effect in 2017
lincom inc_lose + 2017bn.year#c.inc_lose
*effect in 2018
lincom inc_lose + 2018bn.year#c.inc_lose

*****************************************
*Table G1
*****************************************
clear
use aggr.dta

reghdfe ln_freq_nocomp c.inc_lose##c.gap##c.ratio c.agency_politicized c.ln_oppose_firm c.trend_fiscal, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)

*top left cell
lincom c.inc_lose+ c.inc_lose#c.ratio*.1428571      +c.inc_lose#c.ratio#c.gap* .1428571  *   -.2052591  + c.inc_lose#c.gap*   -.2052591
*top right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*   .875    +c.inc_lose#c.ratio#c.gap*   .875  *  -.2052591   + c.inc_lose#c.gap* -.2052591 
*bottom left cell
lincom c.inc_lose+ c.inc_lose#c.ratio*.1428571   +c.inc_lose#c.ratio#c.gap* .1428571  *   .1867498     + c.inc_lose#c.gap *   .1867498  
*bottom right cell  
lincom c.inc_lose+ c.inc_lose#c.ratio*   .875  +c.inc_lose#c.ratio#c.gap *  .875   *   .1867498      + c.inc_lose#c.gap *    .1867498 

*****************************************
*Table G2
*****************************************
reghdfe ln_freq_comp c.inc_lose##c.gap##c.ratio c.agency_politicized c.ln_oppose_firm c.trend_fiscal, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)

*top left cell
lincom c.inc_lose+ c.inc_lose#c.ratio*.1428571      +c.inc_lose#c.ratio#c.gap* .1428571  *   -.2052591  + c.inc_lose#c.gap*   -.2052591
*top right cell
lincom c.inc_lose+ c.inc_lose#c.ratio*   .875    +c.inc_lose#c.ratio#c.gap*   .875  *  -.2052591   + c.inc_lose#c.gap* -.2052591 
*bottom left cell
lincom c.inc_lose+ c.inc_lose#c.ratio*.1428571   +c.inc_lose#c.ratio#c.gap* .1428571  *   .1867498     + c.inc_lose#c.gap *   .1867498 
*bottom right cell    
lincom c.inc_lose+ c.inc_lose#c.ratio*   .875  +c.inc_lose#c.ratio#c.gap *  .875   *   .1867498      + c.inc_lose#c.gap *    .1867498 

*****************************************
*Table H1
*****************************************
use agency_10.dta, clear

reghdfe agency_politicized_sep agency_politicized_dec, noabsorb
reghdfe agency_politicized_june agency_politicized_dec, noabsorb
reghdfe agency_politicized agency_politicized_dec, noabsorb

*****************************************
*Table H2
*****************************************
use agency_18.dta, clear

reghdfe agency_politicized_sep agency_politicized_dec, noabsorb
reghdfe agency_politicized_june agency_politicized_dec, noabsorb
reghdfe agency_politicized agency_politicized_dec, noabsorb

*****************************************
*Table I1
***************************************** 
use main_final.dta, clear

gen band2 = 1
replace band2=2 if inc_lose >= 0.5
*column (1)
reghdfe competition c.inc_lose##i.band2 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)
*column (2)
lincom c.inc_lose + 2.band2#c.inc_lose


*****************************************
*Table I2
*****************************************
gen band3 = 0
replace band3=1 if inc_lose >= 0.33
replace band3=2 if inc_lose >= 0.66
*column (1)
reghdfe competition c.inc_lose##i.band3 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)
*column (2)
lincom c.inc_lose + 1.band3#c.inc_lose
*column (3)
lincom c.inc_lose + 2.band3#c.inc_lose

*****************************************
*Table I3
*****************************************
gen band4 = 0
replace band4=1 if inc_lose >= 0.25
replace band4=2 if inc_lose >= 0.5
replace band4=3 if inc_lose >= 0.75 
*column (1)
reghdfe competition c.inc_lose##i.band4 c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)
*column (2)
lincom c.inc_lose + 1.band4#c.inc_lose
*column (3)
lincom c.inc_lose + 2.band4#c.inc_lose
*column (4)
lincom c.inc_lose + 3.band4#c.inc_lose
 

*****************************************
*Table K1 & Table J2 (Full Results)
*****************************************
*column(1)
reghdfe ln_amount c.inc_lose c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)
*column(2)
reghdfe price c.inc_lose c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)

*****************************************
*Table L1
*****************************************
gen divergence=0 if !missing(ideo_clinton)
replace divergence=1 if year==2010&ideo_clinton<=0.35&!missing(ideo_clinton)
replace divergence=1 if !missing(ideo_clinton)&ideo_clinton>0.35&year==2006
replace divergence=1 if !missing(ideo_clinton)&ideo_clinton>0.35&year==2017
replace divergence=1 if !missing(ideo_clinton)&ideo_clinton>0.35&year==2018
reghdfe competition c.inc_lose##c.divergence c.gap c.ratio c.agency_politicized c.ln_oppose_firm c.dwnom1 c.appr_ways_comm c.seniority c.majority_memb c.female c.black c.latino c.veteran_owned c.small_owned c.minority_owned c.c8a c.his_underutilized battle_next battle_prev chair_appro_h chair_appro_s c.trend_fiscal if placebo==0, absorb(awarding_sub_agency_code product_or_service_code yr_month) cluster(action_date) summarize(mean)











